<template>
  <div>
    <!-- 新增排片计划页面 -->
    为 
    <b style="color:#409EFF;">{{cinemaRoom.cinema_name}}</b> 
    的 
    <b style="color:#409EFF;">{{cinemaRoom.cinema_room_name}} ({{cinemaRoom.cinema_room_type}})</b> 
    新增排片计划

    <!-- 分割线 -->
    <el-divider></el-divider>

    <!-- 表单 -->
    <el-form 
      style="width: 600px;"
      :model="form" :rules="rules" 
      ref="form" label-width="100px" class="demo-form">
      <el-form-item label="选择电影" prop="movie_id">
        <el-select 
          style="width: 100%"
          v-model="form.movie_id" placeholder="请选择电影">
          <el-option label="这个杀手不太冷" value="ID1"></el-option>
          <el-option label="功夫" value="ID2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="开播时间" required>
        <el-col :span="11">
          <el-form-item prop="showingon_date">
            <el-date-picker type="date" placeholder="选择日期" 
              v-model="form.showingon_date" style="width: 100%;"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col style="text-align:center;" :span="2">-</el-col>
        <el-col :span="11">
          <el-form-item prop="showingon_time">
            <el-time-picker placeholder="选择场次" 
              v-model="form.showingon_time" style="width: 100%;"></el-time-picker>
          </el-form-item>
        </el-col>
      </el-form-item>
      <el-form-item label="票价" prop="price">
        <el-input v-model="form.price"></el-input>
      </el-form-item>
      <el-form-item label="是否立即发布" prop="status">
        <el-switch v-model="form.status"></el-switch>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm()">立即新增排片计划</el-button>
        <el-button>重置</el-button>
      </el-form-item>
    </el-form>

  </div>
</template>

<script>
import httpApi from '@/http';
export default {
  data() {
    return {
      form: {
        cinema_id: '',
        cinema_room_id: this.$route.params.roomId,
        movie_id: '',
        showingon_date: '',
        showingon_time: '',
        status: '',
        price: ''
      },
      rules: {

      },
      cinemaRoom: {}, // 存储当前选中的放映厅对象
    };
  },

  methods: {

    /** 提交表单 */
    submitForm(){

    },

    /** 加载放映厅的基本信息 */
    loadRoomInfo() {
      let params = {id: this.form.cinema_room_id}
      httpApi.CinemaRoomApi.queryById(params).then(res=>{
        console.log('查询放映厅的基本信息', res)
        this.cinemaRoom = res.data.data
      })
    }

  },

  mounted(){
    // 加载放映厅的基本信息
    this.loadRoomInfo()
  }
};
</script>

<style lang="scss" scoped></style>
